# 登录页面功能类 - 登录的功能
from selenium import webdriver
from selenium.webdriver.common.by import By
import time


class Login:

    def __init__(self, driver):
        self.dr = driver

    def login(self, drug):
        # 登录
        self.dr.get('http://localhost:8080/mms/')
        self.dr.find_element(By.ID, 'username').send_keys(drug['name'])
        self.dr.find_element(By.ID, 'password').send_keys(drug['pwd'])
        self.dr.find_element(By.XPATH, '/html/body/div[1]/div[1]/div/input').click()
        time.sleep(1)
